<div class="breadcrumbs" id="breadcrumbs">
	<ul class="breadcrumb">
		<li>
			<i class="home-icon fa fa-home"></i>
			<a href="#">订单</a>
		</li>
		<li>
			<a href="#">单据管理</a>
		</li>
		<li class="active">换货单信息</li>
	</ul>
</div>
<div class="content">
	<table class="table form-table">
		<colgroup>
			<col width="130px" />
			<col />
		</colgroup>

		<tbody>
			<tr>
				<th>订单号:</th><td>{$order_no}</td>
			</tr>
			<tr>
				<th>申请时间:</th><td>{$time}</td>
			</tr>
			<tr>
				<th>用户名:</th><td>{$username}</td>
			</tr>
			<tr>
				<th>商品信息:</th>
				<td>
					{foreach:items=Api::run('getOrderGoodsRowById',array('id'=>$order_goods_id))}
					{set:$refundsNum=order_class::refundsDocNums(['order_goods_id' => $order_goods_id,'order_goods_nums' => $order_goods_nums],$item['id'])}
					{set:$goods = JSON::decode($item['goods_array'])}
					<p>
					{$goods['name']} X {$refundsNum}

					{if:$seller_id}
					<a href="{url:/site/home/id/$seller_id}" target="_blank"><i class='fa fa-user'></i></a>
					{/if}
					</p>
					{/foreach}
				</td>
			</tr>
			<tr>
				<th>处理状态:</th>
				<td>{echo:Order_Class::refundmentText($status)}</td>
			</tr>
			<tr>
				<th>处理时间:</th><td>{$dispose_time}</td>
			</tr>
			<tr>
				<th>申请原因:</th><td>{$content}</td>
			</tr>

			{if:$img_list}
            <tr>
                <th>图片信息:</th>
                <td>
                {foreach:items=JSON::decode($img_list) item=$itemImg}
                    <a href="{url:$itemImg}" target="_blank"><img class="img-thumbnail" style="width:100px;height:100px" src="{url:$itemImg}" /></a>
                 {/foreach}
                 </td>
            </tr>
            {/if}

			{if:$user_send_time}
			<tr>
			    <th>买家返还物流:</th>
			    <td>
			        {$user_send_time}
                    <p>
				    {foreach:items=Api::run('getFreightCompanyById',array('freight_id'=>$user_freight_id)) item=$tempFreight}
                    {$tempFreight['freight_name']}
                    {/foreach}

                    【快递单号：{$user_delivery_code}】
                    <button class="btn btn-default btn-sm" type="button" onclick="freightLine({$user_freight_id},'{$user_delivery_code}')">物流跟踪</button>
			        </p>
			    </td>
			</tr>
			{/if}

			{if:$seller_send_time}
			<tr>
			    <th>商家发货物流：</th>
			    <td>
			        {$seller_send_time}
                    <p>
				    {foreach:items=Api::run('getFreightCompanyById',array('freight_id'=>$seller_freight_id)) item=$tempFreight}
                    {$tempFreight['freight_name']}
                    {/foreach}

                    【快递单号：{$seller_delivery_code}】
                    <button class="btn btn-default btn-sm" type="button" onclick="freightLine({$seller_freight_id},'{$seller_delivery_code}')">物流跟踪</button>
			        </p>
			    </td>
			</tr>
			{/if}

			<tr>
				<th>处理意见:</th><td>{$dispose_idea}</td>
			</tr>
			<tr><th>审核人员:</th><td>{if:$admin_id}{query:name=admin where=id eq $admin_id item=$adminRow}{$adminRow['admin_name']}{/query}{else:}商家处理{/if}</td></tr>
			<tr><th></th><td><a href="javascript:window.history.go(-1);" class="btn btn-default">返回</a></td></tr>
		</tbody>
	</table>
</div>

<script>
//快递跟踪
function freightLine(doc_id,code)
{
	var urlVal = "{url:/block/freight/id/@id@/code/@code@}";
	urlVal = urlVal.replace("@id@",doc_id).replace("@code@",code);
	art.dialog.open(urlVal,{title:'轨迹查询',width:'600px',height:'500px'});
}
</script>